package homework;

import java.io.IOException;
import java.util.Objects;
import java.util.Properties;
import java.util.Scanner;

/**
 * @classname:demo04
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/18 20:23
 * @version: 0.1
 * @since:1.8
 */
public class demo04 {
    public static void main(String[] args) {
        login();
    }

    private static void login() {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入用户名");
        String name = input.next();
        System.out.println("请输入密码");
        String password = input.next();

        Properties properties = new Properties();
        try {
            properties.load(demo04.class.getClassLoader().getResourceAsStream("wser.properties"));
            String username = properties.getProperty("user.username");
            String userpass = properties.getProperty("user.userpass");
            if (Objects.equals(name, username) && Objects.equals(password, userpass)) {
                System.out.println("登陆成功");
            }
            System.out.println("不对");

        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
